package LuoGu.搜索.马的遍历;

import java.util.Arrays;
import java.util.Scanner;

public class Main_dfs_fail {
    static int [] x = new int []{1,1,-1,-1,2,2,-2,-2};
    static int [] y = new int []{2,-2,2,-2,1,-1,1,-1};
    static int n;
    static int m;
    static int [][] ans;
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        n = s.nextInt();
        m = s.nextInt();
        int x = s.nextInt()-1;
        int y = s.nextInt()-1;
        ans = new int[n][m];
        for(int[] i:ans) Arrays.fill(i,-1);
        dfs(0,x,y);
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                System.out.print(String.format("%-5d",ans[i][j]));
            }
            System.out.println();
        }
    }

    public static void dfs(int num,int ox,int oy){
        ans[oy][ox] = num;
        for(int i=0;i<8;i++){
            int nx = ox+x[i];
            int ny = oy+y[i];
            if(nx>=0&&ny>=0&&nx<m&&ny<n&&ans[ny][nx]==-1){
                dfs(ans[oy][ox]+1,nx,ny);
            }
        }
    }
}
